const Koa = require('koa');
const Router = require('koa-router');
const bodyParser = require('koa-bodyparser')
const app = new Koa()
const router = new Router();
const modules = require('./routes/articles')
// 使用中间件 主要用于post参数序列化
function useMiddleware(){
    app.use(bodyParser())
  }
// 挂载路由

function InstallRouter(){
    router.use('/api',modules.routes());
    app.use(router.routes()).use(router.allowedMethods());
}
function starts(){
    useMiddleware();
    InstallRouter();
    app.listen(9653, 'localhost')
    console.log('asd')
}
starts();
 